package com.ykq.controller;

import com.ykq.service.UserService;
import com.ykq.service.impl.UserServiceImpl;
import com.ykq.util.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;

/**
 * @program: 145ssm
 * @description:
 * @author: 闫克起2
 * @create: 2021-12-10 09:07
 **/
@Controller
@RequestMapping("/login")
public class LoginController {
    @Autowired  //按照类型匹配
    private UserService userService; //spring容器帮你注入对象。
    @RequestMapping("/login")
    @ResponseBody
    public CommonResult login(String username, String password){
       CommonResult result=userService.findUserByUsernameAndPassword(username,password);
       return result;
    }
}
